package com.lantosec.hmrp.modules.cms.entity;

import com.lantosec.hmrp.core.mvc.BaseEntity;
import com.lantosec.hmrp.modules.cms.vo.CmsCategoryVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

/**
 * <p>
 * CMS栏目管理 实体类
 * </p>
 *
 * @author AutoCode
 * @since 2020-07-06
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CmsCategory extends BaseEntity<CmsCategoryVO> {

    private static final long serialVersionUID = 1L;
    public CmsCategory(CmsCategoryVO vo){
        this.categoryId = vo.getCategoryId();
        this.categoryName = vo.getCategoryName();
        this.parentId = vo.getParentId();
        this.homeFlag = vo.getHomeFlag();
        this.categoryOrder = vo.getCategoryOrder();
    }

    @Override
    public CmsCategoryVO convertToVO(){
        return new CmsCategoryVO(this);
    }


    /**
     * 栏目ID
     */
    @TableId(value = "category_id", type = IdType.ASSIGN_UUID)
    private String categoryId;

    /**
     * 栏目名称
     */
    private String categoryName;

    /**
     * 上级栏目ID
     */
    private String parentId;

    /**
     * 是否首页展示
     */
    private Integer homeFlag;

    /**
     * 排序
     */
    private Integer categoryOrder;


    public enum ColName {
        category_id, category_name, parent_id, home_flag, category_order, 
    }
}
